package org.example.platform.design.zuhe;

import java.util.ArrayList;
import java.util.List;

public class ConctentCompany extends Company {
    List<Company> child = new ArrayList<>();

    public ConctentCompany(String name) {
        super(name);
    }

    @Override
    void add(Company c) {
        child.add(c);
    }

    @Override
    void delete(Company c) {
        child.remove(c);
    }

    @Override
    void shouw(int dept) {
        System.out.println(new String("-".getBytes(), dept) + super.name);
        for (Company c : child) {
            c.shouw(dept + 2);
        }
    }

    @Override
    void run() {
        for (Company c : child) {
            c.run();
        }
    }
}
